﻿using System.Diagnostics.Contracts;

namespace System.Reactive
{
	[ContractClass(typeof(ObservableBaseContract<>))]
	public abstract class ObservableBase<T> : IObservable<T>
	{
		public IDisposable Subscribe(IObserver<T> observer)
		{
			return null;
		}

		public abstract IDisposable SubscribeCore(IObserver<T> observer);
	}

	[ContractClassFor(typeof(ObservableBase<>))]
	internal abstract class ObservableBaseContract<T> : ObservableBase<T>
	{
		public override IDisposable SubscribeCore(IObserver<T> observer)
		{
			Contract.Requires(observer != null, null, "observer != null");
			Contract.Ensures(Contract.Result<IDisposable>() != null, null, "Contract.Result<IDisposable>() != null");
			return null;
		}
	}
}